Skip to content

Comments

TCP: fix timestamp negotiation, RFC6298 compliance, TCP zero-window probe#36

Open
danielinux wants to merge 21 commits intowolfSSL:masterfrom
danielinux:tcp_timestamp_negotiation
Open

TCP: fix timestamp negotiation, RFC6298 compliance, TCP zero-window probe#36
danielinux wants to merge 21 commits intowolfSSL:masterfrom
danielinux:tcp_timestamp_negotiation

Conversation

@danielinux
Copy link
Member

@danielinux danielinux commented Feb 19, 2026

Only send ACKs with TS option if negotiated.

Based on previous PR: #35

Overrides and includes PR #34 PR #35

Copilot AI review requested due to automatic review settings February 19, 2026 17:44
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates wolfIP’s TCP behavior to only include the TCP Timestamp (TS) option in ACKs and data segments when TS has been negotiated, and expands TCP reliability logic around RTO/persist handling.

Changes:

  • Gate TS option emission (ACK options, SYN/SYN-ACK TS inclusion, and data segment TS inclusion) on per-socket TS negotiation state (ts_enabled/ts_offer).
  • Introduce RFC 6298-style RTO computation (SRTT/RTTVAR), Karn’s algorithm (skip RTT samples for retransmitted segments), and control-segment RTO handling for SYN/FIN states.
  • Add TCP persist timer + zero-window probing and corresponding unit tests; update README to mention RTO computation support.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
src/wolfip.c Implements TS negotiation gating; adds RTO/persist/control-RTO logic and new TCP socket fields/flags.
src/test/unit/unit.c Adds/updates unit tests for control RTO, RFC6298 RTO updates, TS omission when not negotiated, and persist probing.
README.md Documents retransmission timeout (RTO) computation support.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

- Fixed bug in smooth average RTT calculation
- Actually assign calculated RTO value (previously fixed to 1s)
- Enforce min/max RTO according to RFC
- Enforce Karn to only account for new ACK in RTO calculation
@danielinux danielinux force-pushed the tcp_timestamp_negotiation branch from 9591b9b to f6c68e2 Compare February 20, 2026 17:17
- Fixed bug in smooth average RTT calculation
- Actually assign calculated RTO value (previously fixed to 1s)
- Enforce min/max RTO according to RFC
- Enforce Karn to only account for new ACK in RTO calculation
Fix: probe_seq may be set to snd_una when snd_una falls within an existing queued segment
Proper clean-up on close: Manage ACK in TCP_LAST_ACK state.
TCP_LAST_ACK in tcp_input() will process ACKs via tcp_ack()
This ensures socket close and control-RTO cleanup only happen when ACK actually covers FIN.
@danielinux danielinux changed the title Tcp timestamp negotiation TCP: fix timestamp negotiation, RFC6298 compliance, TCP zero-window probe Feb 20, 2026
Reported by reviewer on this branch in PR wolfSSL#33

TCP_SYN_RCVD was entered without arming control-RTO from tcp_input()

Added RTO trigger + unit tests.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant